
import cv2
import camera_ctrl as ccl



cap = cv2.VideoCapture(2)
#cap.set(3, 1920)  # width=1920
#cap.set(4, 1080)  # height=1080
#print(ccl.get_camera_info(cap))
ccl.set_camera_parm(cap)
#print(ccl.get_camera_info(cap))
for i in range(3,17):
    print(i,":   ",cap.get(i))


while(True):
    #cv2.namedWindow("video", 0)  # 0 即 cv2.WINDOW_NORMAL，表示可以自己调整窗口大小。注意：此“winname”参数应与后面的inshow()中一致。
    #cv2.resizeWindow("video", 960, 720)  # 修改窗口大小为960X720
    ret,frame = cap.read()
    gray = cv2.cvtColor(frame,cv2.COLOR_RGB2GRAY)
    #图像 ，起点，终点，BGR,粗细
    cv2.line(frame,(0,0),(100,100),(0,255,0),2)
    cv2.rectangle(frame,(0,0),(100,100),(255,255,0),3)# -负值是填充实心
    #图像,圆心，半径，颜色，粗细（-为填充）
    cv2.circle(frame,(50,50),50,(255,255,255),2)
    font=cv2.FONT_HERSHEY_TRIPLEX
    #cv2.putText(frame,ret,(150,100), font, 1,(255,255,255),1)
    cv2.putText(frame,'GUI Demo',(120,50), font, 1,(0,255,255),1)
    
    cv2.imshow('fream',frame)
    
    if cv2.waitKey(20)&0xFF==27:
        break
cap.release()
cv2.destroyAllWindows()